#include<iostream>
#include<string.h>
#include<unistd.h>

__thread int gunm = 0;

void* run(void* args)
{
    std::string name = static_cast<const char*>(args);
    while(1)
    {
        std::cout << "新线程:" << name <<"gunm:"<< gunm << std::endl;
        sleep(1);
    }
}


int main()
{
    pthread_t id;
    pthread_create(&id,nullptr,run,(void*)"run-1");

    while(1)
    {
        std::cout << "主线程:" << gunm << std::endl;
        gunm++;
        sleep(1);
    }
    return 0;
}